//ekincrue

YUI().use('node',function(Y){

	var list = Y.one('.list'),
		newLink = Y.one('#content');

	list.delegate('click',function(){
		this.ancestor('li').remove();
	},'a')

	function addLink(){
		list.append(
			'<li class="list-item"><a href="javascript:" class="del">delete</a>' + newLink.get('value') + '</li>'
		)
		newLink.set('value','');
	}

	Y.one('#sub-btn').on('click', function(){
		if(newLink.get('value') == ""){
			alert('please insert content!')
			return false;
		}else{
			addLink();
		}
	});
	newLink.on('key',addLink,'enter');
});